package com.jeesite.modules.isys.config;

import com.jeesite.modules.swagger.config.SwaggerConfig;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
@ConditionalOnProperty(name="web.swagger.enabled", havingValue="true", matchIfMissing=false)
public class TBSwaggerConfig {

    @Bean
    @ConditionalOnProperty(name="web.swagger.custom.enabled", havingValue="true", matchIfMissing=true)
    public Docket customApi() {
        String moduleCode = "实验室管理系统";
        String moduleName = "实验室管理系统";
        String basePackage = "com.jeesite.modules.isys";
        return SwaggerConfig.docket(moduleCode, moduleName, basePackage)
                .select()
                .apis(
//						Predicates.and(Predicates.and(
//						RequestHandlerSelectors.withClassAnnotation(Api.class),
//						RequestHandlerSelectors.withMethodAnnotation(ResponseBody.class)),
//						RequestHandlerSelectors.basePackage(basePackage))
                        RequestHandlerSelectors.basePackage(basePackage)
                ).build();
    }

}
